package ace.cmp.security.oauth2.resource.server.core.properties;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author caspar
 * @date 2023/2/10 9:21
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = Oauth2ResourceServerSecurityProperties.PROPERTIES_PREFIX)
public class Oauth2ResourceServerSecurityProperties {
  public static final String PROPERTIES_PREFIX = "ace.security.oauth2.resourceserver";

  /**
   * userinfo 模拟返回的数据
   */
  private String inMemoryIntrospectPointUserInfoJson;

  /**
   * token 模拟返回的数据
   */
  private String inMemoryIntrospectPointTokenJson;

  /**
   * 原生结构 token userinfo 模拟返回的数据
   */
  private String inMemoryIntrospectPointOriginTokenUserInfoJson;

  /**
   * 原生结构 token 模拟返回的数据
   */
  private String inMemoryIntrospectPointOriginTokenJson;

  /**
   * 需要安全验证的路径
   * 最后转为{@link org.springframework.security.web.util.matcher.AntPathRequestMatcher}
   */
  private List<String> securityAntPaths = new ArrayList<>(Arrays.asList("/graphql"));
}
